import { FormSchema } from '/@/components/Table';
export const formSchema: FormSchema[] = [
  {
    field: 'email',
    label: '邮箱',
    component: 'Input',
    colProps: { span: 23 },
    required: true,
  },
  {
    field: 'emailUser',
    label: '用户名',
    component: 'Input',
    colProps: { span: 23 },
    required: true,
  },
  {
    field: 'emailPwd',
    label: '密码(QQ邮箱请输入授权码)',
    component: 'InputPassword',
    colProps: { span: 23 },
    required: true,
    componentProps: {
      autocomplete: 'new-password',
    },
  },
  {
    field: 'server',
    label: 'SMTP服务器',
    component: 'Input',
    colProps: { span: 23 },
    required: true,
  },
  {
    field: 'smtpPort',
    label: 'SMTP端口',
    component: 'Input',
    colProps: { span: 23 },
    required: true,
  },
  {
    field: 'serverPop3',
    label: 'POP3服务器',
    component: 'Input',
    colProps: { span: 23 },
    required: true,
  },
  {
    field: 'port',
    label: 'POP3端口',
    component: 'Input',
    colProps: { span: 23 },
    required: true,
  },
  {
    field: 'isSsl',
    label: '使用SSL',
    component: 'Checkbox',
    colProps: { span: 23 },
    componentProps: ({ formModel }) => {
      console.log('formModel', formModel);
      return {
        onChange: (e) => {
          console.log('e', e);
          const { checked } = e.target;
          if (checked) {
            formModel.smtpPort = '465';
            formModel.port = '995';
          } else {
            formModel.smtpPort = '25';
            formModel.port = '110';
          }
        },
      };
    },
  },
  {
    field: 'isDelete',
    label: '邮件收到时删除服务器上邮件',
    component: 'Checkbox',
    colProps: { span: 23 },
  },
  {
    field: 'isDefault',
    label: '是否为默认邮箱',
    component: 'Checkbox',
    colProps: { span: 23 },
  },
];
